<template>
    <div class="container">
        <div class="typing">
            <slot></slot>
        </div>
    </div>

</template>

<style scoped>
.container {
    /* 包含整个浏览器，背景颜色#333 */
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #333;
    z-index: -1;
}

.typing {
    /* 居中 */
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);

    /* 字体 */
    color: white;
    font-size: 2em;
    width: 21em;
    height: 1em;
    border-right: 1px solid transparent;
    animation: typing 2s steps(42, end), blink-caret .75s step-end infinite;
    font-family: 'Times New Roman', Times, serif;
    /* word-break: break-all; */
    overflow: hidden;
}

/* 打印效果 */
@keyframes typing {
    from {
        width: 0;
    }

    to {
        width: 21em;
    }
}

/* 光标 */
@keyframes blink-caret {

    from,
    to {
        border-color: transparent;
    }

    50% {
        border-color: currentColor;
    }
}

</style>